from django.conf.urls.defaults import patterns, include, url
from django.views.generic.simple import direct_to_template
from gardens.views import *
import os

import django.contrib.auth.views

from django.contrib import admin

admin.autodiscover()

site_media = os.path.join(
	os.path.dirname(__file__), 'site_media'
)

# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()

urlpatterns = patterns('',
	
	url(r'^$', main_page),
	url(r'^account/$', account_page),
	url(r'^account/updated/$', direct_to_template, {'template': 'registration/account_updated.html'}),
	url(r'^calc/$', calc_page),
	url(r'^credits/$', direct_to_template, {'template': 'credits.html'}),
	url(r'^deleter/$', deleter_ajax),
	url(r'^delete_account/$', delete_page),
	url(r'^denied/$', direct_to_template, {'template': 'denied.html'}),
	url(r'^duplicater/$', duplicater_ajax),
	url(r'^loader/$', loader_ajax),
	url(r'^login/', 'django.contrib.auth.views.login'),
	url(r'^logout/$',logout_page),
	url(r'^photos/$', photo_loader_ajax),
	url(r'^plants/$', plant_loader_ajax),
	url(r'^privacy/$', direct_to_template, {'template': 'privacy.html'}),
	url(r'^register/$', register_page),
	url(r'^register/success/$', direct_to_template, {'template': 'registration/register_success.html'}),
	url(r'^saver/$', saver_ajax),
	url(r'^site_media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': site_media}),
	url(r'^terms/$', direct_to_template, {'template': 'terms.html'}),

	
	# Password stuff (using the built-in templates)
	#url(r'^password_reset/$', 'django.contrib.auth.views.password_reset'),
	#url(r'^password_reset/done/$', 'django.contrib.auth.views.password_reset_done'),
	#url(r'^reset/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$', 'django.contrib.auth.views.password_reset_confirm'),
	#url(r'^reset/done/$', 'django.contrib.auth.views.password_reset_complete'),
	
	# Password reset stuff (using custom templates)
	url(r'^password_reset/$', 'django.contrib.auth.views.password_reset', {'template_name':'registration/password_reset_form.html', 'email_template_name':'registration/password_reset_email.html'}),
	url(r'^password_reset/done/$', 'django.contrib.auth.views.password_reset_done', {'template_name':'registration/password_reset_done.html'}),
	url(r'^reset/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$', 'django.contrib.auth.views.password_reset_confirm', {'template_name':'registration/password_reset_confirm.html'}),
	url(r'^reset/done/$', 'django.contrib.auth.views.password_reset_complete', {'template_name':'registration/password_reset_complete.html'}),
	
	# Password change
	url(r'^password_change/$', 'django.contrib.auth.views.password_change', {'template_name':'registration/password_change_form.html', 'post_change_redirect': 'success'}),
	url(r'^password_change/success/$', direct_to_template, {'template': 'registration/password_change_done.html'}),
	
	# Uncomment the admin/doc line below to enable admin documentation:
	url(r'^admin/doc/', include('django.contrib.admindocs.urls')),

	# Uncomment the next line to enable the admin:
	url(r'^admin/', include(admin.site.urls)),
	#url(r'^admin/', include(admin.site.root)),
)
